import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";
import MyView from "../views/MyView.vue";
import ShopView from "../views/ShopView.vue";
import Layout from "../views/Layout.vue";
import goodsDetails from "../components/goodsDetails.vue";
import goodsList from "../components/goodsList.vue";
import pay from "../components/pay.vue";

const routes = [
  {
    path: "/",
    redirect: '/home',
    component: Layout,
    children: [
      {
        path: "home",
        name: 'home',
        component: HomeView

      },
      {
        path: "my",
        name: "my",
        component: MyView,
      },
      {
        path: "shop",
        name: "shop",
        component: ShopView,
      },
    ]
  },
  {
    path: '/goodsDetails',
    name: 'goodsDetails',
    component: goodsDetails
  },
  {
    path: "/pay",
    name: "pay",
    component: pay,
  },
  {
    path: '/goodsList',
    name: 'goodsList',
    component: goodsList
  }
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
